package com.ruoyi.student.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.student.domain.vo.TGradeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.student.mapper.TGradeMapper;
import com.ruoyi.student.domain.TGrade;
import com.ruoyi.student.service.ITGradeService;

/**
 * 年级Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-08-15
 */
@Service
public class TGradeServiceImpl implements ITGradeService 
{
    @Autowired
    private TGradeMapper tGradeMapper;

    /**
     * 查询年级
     * 
     * @param id 年级主键
     * @return 年级
     */
    @Override
    public TGrade selectTGradeById(Long id)
    {
        return tGradeMapper.selectTGradeById(id);
    }

    /**
     * 查询年级列表
     * 
     * @param tGrade 年级
     * @return 年级
     */
    @Override
    public List<TGrade> selectTGradeList(TGrade tGrade)
    {
        return tGradeMapper.selectTGradeList(tGrade);
    }
    /**
     * 查询年级列表 添加创建人名字
     *
     * @param tGrade 年级
     * @return 年级
     */
    @Override
    public List<TGradeVo> selectTGradeVoList(TGrade tGrade) {

        return tGradeMapper.selectTGradeVoList(tGrade.getGradeName(),tGrade.getCreatorId(),tGrade.getValidFlag());
    }

    /**
     * 新增年级
     * 
     * @param tGrade 年级
     * @return 结果
     */
    @Override
    public int insertTGrade(TGrade tGrade)
    {
        tGrade.setCreateTime(DateUtils.getNowDate());
        return tGradeMapper.insertTGrade(tGrade);
    }

    /**
     * 修改年级
     * 
     * @param tGrade 年级
     * @return 结果
     */
    @Override
    public int updateTGrade(TGrade tGrade)
    {
        tGrade.setUpdateTime(DateUtils.getNowDate());
        return tGradeMapper.updateTGrade(tGrade);
    }

    /**
     * 批量删除年级
     * 
     * @param ids 需要删除的年级主键
     * @return 结果
     */
    @Override
    public int deleteTGradeByIds(Long[] ids)
    {
        return tGradeMapper.deleteTGradeByIds(ids);
    }

    /**
     * 删除年级信息
     * 
     * @param id 年级主键
     * @return 结果
     */
    @Override
    public int deleteTGradeById(Long id)
    {
        return tGradeMapper.deleteTGradeById(id);
    }
}
